package com.mask.im.business.controller.group;

import com.mask.im.business.model.dto.GroupChatShowDTO;
import com.mask.im.business.common.model.RestResponse;
import com.mask.im.business.service.IMGroupChatUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户群聊关联表
 *
 * @author jian
 */

@Api(tags = "群聊和用户关联模块")
@RestController
public class IMGroupChatUserController {

    @Resource
    private IMGroupChatUserService groupChatUserService;

    @ApiOperation("退出群聊")
    @PutMapping("/group_chat_user/leaveGroupChat/{groupChatId}")
    public RestResponse<String> leaveGroupChat(@PathVariable("groupChatId") Integer groupChatId) {
        return groupChatUserService.leaveGroupChat(groupChatId);
    }

    @ApiOperation("获取不在群聊中的好友")
    @GetMapping("/group_chat_user/notGroupChatFriend")
    public RestResponse<List<GroupChatShowDTO>> notGroupChatFriend(
            @RequestParam(value = "keyword", defaultValue = "") String keyword,
            @RequestParam(value = "groupId") Integer groupId) {
        return groupChatUserService.notGroupChatFriend(keyword, groupId);
    }
}

